package com.yc.web.controller;

import com.yc.model.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/stu")
public class StuController {

    @RequestMapping("/list")
    public String list(Map<String ,Object> data){
        data.put("user","t1");
        data.put("age",21);
        data.put("gender","男");
        List<User> list=new ArrayList<User>();
        list.add(new User("uu","uu"));
        list.add(new User(2,"uu2","uu"));
        list.add(new User(3,"uu","3uu"));
        data.put("stu",list);
        return "stu/list";

    }
    @RequestMapping("/list2")
    public String list(Model model){


        model.addAttribute("user2","t2");
        model.addAttribute("age2",21);
        List<User> list=new ArrayList<User>();

        list.add(new User(1,"2","2"));
        list.add(new User(3,"23","33"));
        model.addAttribute("list2",list);
        return "stu/list2";

    }



}
